package com.cskaoyan.config;

import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@EnableWebMvc
public class WebConfiguration implements WebMvcConfigurer {

    /**
     * 假设你在d盘的spring文件夹下有个1.jpg的图片
     * 要你通过/hello/world/1.jpg能够访问到该图片
     */
    //TODO: 三种写法 -> / classpath:/xx/ file:d:/xx/
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/hello/world/**").addResourceLocations("file:d:/wd/pic/");
    }
}
